/*
 * @Author: 'zhangkeqq' '2211709169@qq.com'
 * @Date: 2025-07-26 19:01:42
 * @LastEditors: 'zhangkeqq' '2211709169@qq.com'
 * @LastEditTime: 2025-08-04 20:24:30
 * @FilePath: \vue3-admin-node\vue3-admin\src\permission.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import router from './router'
import {useMenu} from '@/store/modules/menu'

// 全局前置守卫
router.beforeEach( (to, from, next) => {
    const token =localStorage.getItem('token')
      if(token){
        // const menuStore = useMenu()
        //  menuStore.getMenu()
         next()
      }else{
         //用户未登录
        if (to.path === '/login') {
            next()
        } else {
            next({ path: '/login'})
        }
      }
})

